package com.example.security.controller;

import com.example.security.VO.ResultVO;
import com.example.security.entity.User;
import com.example.security.repository.UserRepository;
import com.example.security.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserRepository userRepository;

    @GetMapping("/find/all")
    public ResultVO findAllUsers(){
        List<User> users = userRepository.findAll();
        return ResultUtil.success(users);
    }

    @GetMapping("/test1")
    public ResultVO test1(){
        return ResultUtil.success();
    }

    @GetMapping("/test2")
    public ResultVO test2(){
        return ResultUtil.success();
    }

    @GetMapping("/test3")
    public ResultVO test3(){
        return ResultUtil.success();
    }
}
